package com.artron.mediaartron.data.entity;

import com.artron.mediaartron.data.config.AppProfile;

import java.util.ArrayList;
import java.util.List;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-10-27.
 */

public class Works {


    /**
     * passportId : 10000030
     * worksName : 旅行记
     * worksPrice : 100
     * worksTypeCode : voyage
     * worksShape : 硬纸框
     * worksColor : 棕色
     * worksSize : 263X266
     * worksQuantity : 2
     * skuCode : D09006
     * materialId : 6667791fc049482f820642a655d9e711
     * worksClientCode : 默认为ios
     * worksChannelCode : 渠道编号，默认为arton
     * materialEdit : [{"materialId":"6667791fc049482f820642a655d9e711","pageNumber":1,"materialIndex":1,"x":0,"y":0,"width":1553,"height":1570,"rotate":0,"scale":2,"isDefaultTemplate":1,"templateNumber":7},{"materialId":"73cbd1f906fe4bbbbc975556ad4ed6eb","pageNumber":1,"materialIndex":2,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":7},{"materialId":"822dea84349d45339a72a852894f661d","pageNumber":1,"materialIndex":3,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":7},{"materialId":"f28d498dea0c42d787af644cd41fb964","pageNumber":2,"materialIndex":1,"x":0,"y":0,"width":1553,"height":1570,"rotate":0,"scale":3,"isDefaultTemplate":1,"templateNumber":7},{"materialId":"ffdd22f06d15432581a30a2e417601e8","pageNumber":3,"materialIndex":1,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":2},{"materialId":"d539b70b05ba499399f444d7bf9dcffd","pageNumber":4,"materialIndex":2,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":4},{"materialId":"e55c707ef481447a90a719321d43ef3f","pageNumber":0,"materialIndex":1,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":0},{"materialId":"072b88aa93e54f23bc1c9201c90c8549","pageNumber":0,"materialIndex":2,"x":0,"y":0,"width":0,"height":0,"rotate":0,"scale":0,"isDefaultTemplate":1,"templateNumber":0}]
     * textEdit : [{"pageNumber":1,"templateNumber":7,"textNumber":1,"content":"第七模板，第一文本。"},{"pageNumber":0,"templateNumber":0,"textNumber":1,"content":"封首主标题，封首主标题，封首主标题"},{"pageNumber":0,"templateNumber":0,"textNumber":2,"content":"封尾简介，封尾简介，封尾简介，封尾简介，封尾简介，封尾简介，封尾简介，封尾简介，封尾简介，封尾简介。"}]
     */



    private String passportId;
    private String worksName;
    private int worksPrice;
    private String worksTypeCode;
    private String worksShape;
    private String worksColor;
    private String worksSize;
    private int worksQuantity = 1;
    private String skuCode;
    private String materialId;
    private String worksClientCode;
    private String worksChannelCode;
    /**
     * materialId : 6667791fc049482f820642a655d9e711
     * pageNumber : 1
     * materialIndex : 1
     * x : 0
     * y : 0
     * width : 1553
     * height : 1570
     * rotate : 0
     * scale : 2
     * isDefaultTemplate : 1
     * templateNumber : 7
     */

    private List<MaterialEditBean> materialEdit;
    /**
     * pageNumber : 1
     * templateNumber : 7
     * textNumber : 1
     * content : 第七模板，第一文本。
     */

    private List<TextEditBean> textEdit;

    public Works() {
        this.passportId = AppProfile.getUserInfo().getPassId();
    }

    public Works addEditBean(MaterialEditBean bean) {
        if (this.materialEdit == null) {
            materialEdit = new ArrayList<>();
        }
        materialEdit.add(bean);
        return this;
    }

    public Works addEditBean(List<MaterialEditBean> bean) {
        if (this.materialEdit == null) {
            materialEdit = new ArrayList<>();
        }
        materialEdit.addAll(bean);
        return this;
    }

    public MaterialEditBean getEditBean(int position) {
        try {
            return getMaterialEdit().get(position);
        } catch (Exception e) {
            return null;
        }
    }

    public String getPassportId() {
        return passportId;
    }

    public Works setPassportId(String passportId) {
        this.passportId = passportId;
        return this;
    }

    public String getWorksName() {
        return worksName;
    }

    public Works setWorksName(String worksName) {
        this.worksName = worksName;
        return this;
    }

    public int getWorksPrice() {
        return worksPrice;
    }

    public Works setWorksPrice(int worksPrice) {
        this.worksPrice = worksPrice;
        return this;
    }

    public String getWorksTypeCode() {
        return worksTypeCode;
    }

    public Works setWorksTypeCode(String worksTypeCode) {
        this.worksTypeCode = worksTypeCode;
        return this;
    }

    public String getWorksShape() {
        return worksShape;
    }

    public Works setWorksShape(String worksShape) {
        this.worksShape = worksShape;
        return this;
    }

    public String getWorksColor() {
        return worksColor;
    }

    public Works setWorksColor(String worksColor) {
        this.worksColor = worksColor;
        return this;
    }

    public String getWorksSize() {
        return worksSize;
    }

    public Works setWorksSize(String worksSize) {
        this.worksSize = worksSize;
        return this;
    }

    public int getWorksQuantity() {
        return worksQuantity;
    }

    public Works setWorksQuantity(int worksQuantity) {
        this.worksQuantity = worksQuantity;
        return this;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public Works setSkuCode(String skuCode) {
        this.skuCode = skuCode;
        return this;
    }

    public String getMaterialId() {
        return materialId;
    }

    public Works setMaterialId(String materialId) {
        this.materialId = materialId;
        return this;
    }

    public String getWorksClientCode() {
        return worksClientCode;
    }

    public Works setWorksClientCode(String worksClientCode) {
        this.worksClientCode = worksClientCode;
        return this;
    }

    public String getWorksChannelCode() {
        return worksChannelCode;
    }

    public Works setWorksChannelCode(String worksChannelCode) {
        this.worksChannelCode = worksChannelCode;
        return this;
    }

    public List<MaterialEditBean> getMaterialEdit() {
        if (materialEdit == null) {
            materialEdit = new ArrayList<>();
        }
        return materialEdit;
    }

    public Works setMaterialEdit(List<MaterialEditBean> materialEdit) {
        this.materialEdit = materialEdit;
        return this;
    }

    public List<TextEditBean> getTextEdit() {
        return textEdit;
    }

    public Works setTextEdit(List<TextEditBean> textEdit) {
        this.textEdit = textEdit;
        return this;
    }

    public static class MaterialEditBean {
        private String materialId;
        private int pageNumber = 1;
        private int materialIndex = 1;
        private float x;
        private float y;
        private float width;
        private float height;
        private float rotate;
        private float scale;
        private int isDefaultTemplate = 1;
        private int templateNumber = 1;

        public MaterialEditBean(){}

        public MaterialEditBean(String materialId, int pageNumber, int materialIndex, float x, float y, float width,
                                float height, float rotate, float scale, int isDefaultTemplate, int templateNumber) {
            this.materialId = materialId;
            this.pageNumber = pageNumber;
            this.materialIndex = materialIndex;
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.rotate = rotate;
            this.scale = scale;
            this.isDefaultTemplate = isDefaultTemplate;
            this.templateNumber = templateNumber;
        }

        public String getMaterialId() {
            return materialId;
        }

        public void setMaterialId(String materialId) {
            this.materialId = materialId;
        }

        public int getPageNumber() {
            return pageNumber;
        }

        public void setPageNumber(int pageNumber) {
            this.pageNumber = pageNumber;
        }

        public int getMaterialIndex() {
            return materialIndex;
        }

        public void setMaterialIndex(int materialIndex) {
            this.materialIndex = materialIndex;
        }

        public float getX() {
            return x;
        }

        public void setX(float x) {
            this.x = x;
        }

        public float getY() {
            return y;
        }

        public void setY(float y) {
            this.y = y;
        }

        public float getWidth() {
            return width;
        }

        public void setWidth(float width) {
            this.width = width;
        }

        public float getHeight() {
            return height;
        }

        public void setHeight(float height) {
            this.height = height;
        }

        public float getRotate() {
            return rotate;
        }

        public void setRotate(float rotate) {
            this.rotate = rotate;
        }

        public float getScale() {
            return scale;
        }

        public void setScale(float scale) {
            this.scale = scale;
        }

        public int getIsDefaultTemplate() {
            return isDefaultTemplate;
        }

        public void setIsDefaultTemplate(int isDefaultTemplate) {
            this.isDefaultTemplate = isDefaultTemplate;
        }

        public int getTemplateNumber() {
            return templateNumber;
        }

        public void setTemplateNumber(int templateNumber) {
            this.templateNumber = templateNumber;
        }
    }

    public static class TextEditBean {
        private int pageNumber;
        private int templateNumber;
        private int textNumber;
        private String content;

        public TextEditBean(int pageNumber, int templateNumber, int textNumber, String content) {
            this.pageNumber = pageNumber;
            this.templateNumber = templateNumber;
            this.textNumber = textNumber;
            this.content = content;
        }

        public int getPageNumber() {
            return pageNumber;
        }

        public void setPageNumber(int pageNumber) {
            this.pageNumber = pageNumber;
        }

        public int getTemplateNumber() {
            return templateNumber;
        }

        public void setTemplateNumber(int templateNumber) {
            this.templateNumber = templateNumber;
        }

        public int getTextNumber() {
            return textNumber;
        }

        public void setTextNumber(int textNumber) {
            this.textNumber = textNumber;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }
    }
}
